home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / DATABASE / OBJ1_2.ZIP;1 / OB_BASIC.TXT < prev    next >
Encoding:
Text File  |  1993-01-27  |  17.2 KB  |  417 lines

  1. '
  2. 'This chapter menu
  3. '^^^^^^^^^^^^^^^^^
  4. '
  5. '!short:Basic of the library
  6. '!short:Meaning of the words
  7. '!short:Syntax
  8. '!short:How to compile source code to obtain *.exe
  9. '!short:Library created and used database files
  10. '!short:Simple demo for working with objects
  11. '!short:Visibility of objects in the CLD (clipper debugger)
  12. '!short:Hardware requirements
  13. '!short:System anomal behavior or what to expect and what no
  14. '!short:
  15. '!short:Public variables = global variables created by the library
  16. '!short:===================================================================
  17. '!short:name       type     short description
  18. '!short:---------- -------- -----------------------------------------------------
  19. '!short:m->tColor  numeric  0=monochrom, 1=laptop, 2=VGAmono, 3=color monitor
  20. '!short:m->Color   object   color values recieved by the window painting
  21. '
  22. '
  23. '####################################################################################
  24. !short:Basic of the library
  25. ^BBasic of the library - short description
  26. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  27.  
  28.                                  OBJECT.LIB
  29.             high level object oriented library for Clipper v5.01
  30.            ******************************************************
  31.                copyright (c) 1992, JHK, JHK-Software, Piestany
  32.  
  33. Motto:
  34. ~~~~~~
  35.    Database programs on the fly!
  36.  
  37.  
  38.  
  39. Basic features:
  40. ~~~~~~~~~~~~~~~
  41.    - object oriented (classes,heredity,...)
  42.    - user task swapping
  43.    - "Windows - like" user interface
  44.    - multithreading is enabled
  45.    - event driven programming support through the philosophy of the library
  46.    - data driven programming capability and design
  47.    - generated code is true network capable
  48.    - user defined reports
  49.    - user defined filters
  50.    - user defined indexes
  51.    - unlimited paswords, user privileges individual to every menu item,
  52.      every database field
  53.    - automatic generated help system with context help
  54.    - user defined help system
  55.    - all graphical cards text mode support
  56.      (CGA,EGA,VGA,HGC,laptops,monochromVGA,...)
  57.    - clipper language enhancements
  58.    - dramatical shortening of a aplication developement time, aplication
  59.      length in 200 to 2000 (for very large apps.) source code lines
  60.    - basic functions of a program can be presented to the user in the very
  61.      first time consulting his problem
  62.    - simple program maintenance
  63.    - documentation in a form of "norton guide" in a file OBJECT.NG
  64.  
  65.    The library is 420kB of source code with 330kB of documentation,
  66.    consists of 450 functions, methods or procedures and many new commands.
  67.  
  68.  
  69. !seealso: "Meaning of the words" Syntax "Simple demo"
  70.  
  71.  
  72. '####################################################################################
  73. !short:Meaning of the words
  74. ^BMeaning of the words:
  75. ~~~~~~~~~~~~~~~~~~~~~~~
  76.  
  77.  CLASS ... is a composing of common features of any later defined object
  78.    It consists of all needed variables (VAR) and functions (METHOD) for exact
  79.    description of any object features. It remembers to Pascal record
  80.    definition or to union in C with extensions to methods and hereditarity.
  81.  
  82.  OBJECT ... is a real variable derived from further defined class. Clipper
  83.    objects can be of four basic classes (Error,Get,Tbrowse,Tbcolumn).
  84.    Non-clipper objects can be of any user defined class.
  85.  
  86.  NON-CLIPPER OBJECT ... uses clipper send technique (:) for sending messages
  87.    to objects. It is created of user defined classes, with use of
  88.    herediterity and overlaying of methods. When using the object system
  89.    o:Clip it is not possible to use the standard clipper classes (Error,Get,
  90.    TBrowse,TBColumn). The system Class(y) enables this use. Hovever this
  91.    library cannot use this Class(y) feature, because this must work with
  92.    o:Clip too. If you have the Class(y) library, use it! (instead default
  93.    o:Clip). o:Clip has various problems in debugging in multifile
  94.    application.
  95.  
  96.  VAR ... one object variable, as array element of object representing array.
  97.  
  98.  METHOD ... is the proces (code) part of the object, describing how to change
  99.    the object satus. It presents some function which can manipulate the
  100.    object instances (variables) and in that way change the object status.
  101.  
  102.  INHERITANCE ... is the basic feature of object oriented language.
  103.    It enables to create a new class in the following way:
  104.    1. New class inherits all variables and methods of some other class
  105.    2. It modifies the methods, which are not sufficient to new demands.
  106.    3. New class is apended with new variables and methods which are not
  107.       present in parent class.
  108.    This enables incremental programing with reuse of once generated code.
  109.  
  110.  PUBLIC, PRIVATE, READ-ONLY, OVERRIDE
  111.    By description of variables of some class are used this labels to
  112.    emphasize the possible use of any variables.
  113.  
  114.    PUBLIC means that variable can be changed anywhere
  115.  
  116.    PRIVATE is variable for internal object use, it is not recomended to
  117.      change its content or use it in any way.
  118.  
  119.    READ-ONLY is variable only for reading, it is modified by the own
  120.      object methods.
  121.  
  122.    OVERRIDE indicates that the herited default value is rewritten to
  123.      new default value.
  124.  
  125.    ^UMethod description:^N
  126.    PUBLIC is common used method
  127.    PRIVATE is internal method of the class
  128.  
  129.  
  130. !seealso: Syntax "Simple demo" "System anomal behavior"
  131.  
  132.  
  133. '####################################################################################
  134. !short:Syntax for non-clipper objects
  135. ^BSyntax for non-clipper objects:
  136. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  137. You can decide for Class(y) or o:Clip object systems.
  138. Your decision must be ressponsed in your used syntax and help.
  139. The library is written in the way that by defining of options
  140. #define CLASSY or #define OCLIP in the file  object.ch can be generated
  141. the required object library.
  142.  
  143.  
  144. '####################################################################################
  145. !short:How to compile source code to obtain *.exe
  146. ^BHow to compile source code to obtain *.exe :
  147. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  148. Yor programs can be converted from the form of *.prg to *.exe in the next
  149. steps:
  150.  
  151. 1. Compilation with debug option
  152.              Clipper my_file /n/m/w/a/b/p
  153.              RtLink FI my_file PLL Object
  154.  
  155. 2. Compilating to distribute
  156.              Clipper my_file /n/m/w/a/l
  157.              RtLink FI my_file LIB Object
  158.  
  159. The first line creates from the file my_file.PRG the files:
  160.       my_file.PPO  (if there was a /p switch)
  161.       my_file.OBJ
  162.  
  163. the second line produces the very desired file my_file.exe !!!. Off course
  164. only when the compiling was without error(s). (:-))
  165.  
  166. !seealso: "Meaning of the words" "Simple demo" "System anomal behavior"
  167.  
  168.  
  169. '####################################################################################
  170. !short:Library created and used database files
  171. ^BLibrary created and used database files:
  172. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  173. The classes View (file c_view.prg), Menu (file c_Menu.prg) and Dbf (file
  174. c_dbf.prg) need for user defined indexes, filters and reports and for help
  175. to menu system and to database fields three system databases:
  176.  
  177. ^USystem1.dbf^N usernames, passwords and privileges of users are stored here.
  178.  
  179. ^USystem2.dbf^N index, report and filter definitions.
  180.  
  181. ^USystem3.dbf^N help texts to menu items and to databse fields, the respective
  182.             functions are in file Object2.
  183.  
  184. For creating any new index file (user defined) is the name created by library
  185. as following: ^USysN0000.ntx^N where for 0000  can be substituted any number
  186. in range from 0000 to 9999.
  187.  
  188. When producing a report, it is printed to a file and this file is printed
  189. to printer. The file name is created by library as following: ^USysR0000.ntx^N
  190. where for 0000  can be substituted any number in range from 0000 to 9999.
  191.  
  192. The program created with help of Object.lib searches the curerrent directory
  193. for needed database files. If you need to store any database fields to other
  194. then current directory, use the full pathaname in database structure
  195. definition (object of class Dbf), (in form of Dos path + file name).
  196.  
  197. When program ends with an error (that can be handled by clipper ErrorBlock)
  198. is file SysError.txt created and the stack list is written to it. The
  199. file name can be changed by SET ERRORS FILE.
  200.  
  201. The temporary file ^USysTmp$$^N is used for creating of temporary indexes for
  202. totaling and subtotaling in reports (c_report.prg) or as temp file for
  203. database structure generating (c_dbf.prg)
  204.  
  205. System file names can be changed in source library code (Object.ch), this
  206. needs recompiling of the library to take effect.
  207.  
  208.  
  209.  
  210. !seealso: c_dbf.ngo:Dbf c_view.ngo:View c_menu.ngo:Menu ob_comma.ngo:"SET ERRORS FILE"
  211.  
  212.  
  213. '####################################################################################
  214. !short:Simple demo for working with objects
  215. ^BSimple demo for working with objects:
  216. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  217.  
  218. //class definition example:
  219. //----------------------------------------
  220.  class Loc                 //class Loc (location)
  221.    export:                 //instances and methods visible in child classes
  222.                            //and also in class Loc object
  223.    var Row                 //Row element
  224.    var Col                 //Column element
  225.    method New=LocNew       //call o:New()  instances initialisation
  226.    method Get=LocGet       //call o:Get()  storing the position
  227.    method Set=LocSet       //call o:Set()  reseting the stored position
  228.    endclass
  229.  
  230.  constructor LocNew() no parent   //preprocessor compile see Object.ch
  231.    ::Row:=0
  232.    ::Col:=0
  233.    return(self)            //returns self (object)
  234.  
  235.  method function LocGet()  //can be rewritten in "child" classes
  236.    ::Row:=Row()            //stored the row
  237.    ::Col:=Col()            //stored the column
  238.    return(nil)
  239.  
  240.  method function LocSet()  //can be rewritten in "child" classes
  241.    SetPos(::Row,::Col)     //restore the position
  242.    return(nil)
  243.  
  244.  //...................................................................
  245.  class Cursor from Loc   //class cursor herited all features of class Loc
  246.    export:               //and has new variable
  247.    var Size              //size and methods
  248.    method New=CursorNew  //instances initilisation
  249.    method Get=CursorGet  //o:Get()  modify Loc:Get() in sense of
  250.                          //           store the size of cursor too
  251.    method Set=CursorSet  //o:Set()  reset the stored cursor
  252.    endclass
  253.  
  254.  constructor ScreenNew()  //instances of class Cursor are initialised
  255.    ::Size:=SC_NONE        //(i.e. Size, Row, Col)
  256.    return(self)           //returns self (object)
  257.  
  258.  method function CursorGet() //can be rewritten in "child" classes
  259.    ::parent:Get()            //store Row,Col (use the herited method)
  260.    ::Size:=SetCursor()       //store the cursor size
  261.    return(nil)
  262.  
  263.  method function CursorSet() //can be rewritten in "child" classes
  264.    ::parent:Set()            //store Row, Col (use herited instance)
  265.    SetCursor(::Size)         //restore the cursor
  266.    return(nil)
  267.  
  268.  //.....................................................................
  269.  class Screen from Cursor //the class screen herited the cursor features
  270.    export:                //and adds the items
  271.    var Screen             //screen_buffer
  272.    var Color              //clipper color definition
  273.                           //and the methods
  274.    method New=ScreenNew   //o:New()  initial instances set
  275.    method Get=ScreenGet   //o:Get()  modify Cursor:Get() to store the screen
  276.    method Set=ScreenSet   //o:Set()  restore the saved screeen
  277.    endclass
  278.  
  279.  constructor ScreenNew()  //class Screen instances are modified
  280.    ::Screen:=""           //(i.e. Screen, Color, Size, Row, Col)
  281.    ::Color:=""
  282.    return(self)           //returns self (object)
  283.  
  284.  method function ScreenGet()  //can be rewritten in "child" classes
  285.    ::parent:Get()             //store the cursor
  286.    ::Color:=SetColor()        //store the colors
  287.    ::Screen:=SaveScreen(0,0,MaxRow(),MaxCol())  //store the screen
  288.    return(nil)
  289.  
  290.  method function ScreenSet()  //can be rewritten in "child" classes
  291.    ::parent:Set()             //restore the cursor
  292.    SetColor(::Color)          //restore the colors
  293.    RestScreen(0,0,MaxRow(),MaxCol(),::Screen)  //restore the screen
  294.    return(nil)
  295.  
  296. //defined classes using demo:
  297. //---------------------------
  298. function OurFunction()
  299.   local object Cursor of Cursor //create local object Cursor of class Cursor
  300.   local object Obr1 of Screen   //create local object Obr1 of class Screen
  301.   local object Obr2 of Screen   //...
  302.   Cursor:Get()                  //store the current cursor location
  303.   InaProcedura("Change cursor") //cursor change
  304.   Cursor:Set()                  //resture the cursor size and location
  305.   Obr1:Get()                    //store the whole screen
  306.   InaProcedura("Change screen") //screen change
  307.   Obr2:Get()                    //store the changed screen
  308.   repeat                        //repeat to until
  309.     PauseKey(0)                 //wait for keypressing (SetKey() processed)
  310.     Swap(Obr1,Obr2)             //swap of variables
  311.     Obr2:Set()                  //show the screen (two screens swapping)
  312.   until LastKey()==K_ESC        //ends when pressing ESC
  313.   return(nil)
  314.  
  315. WARNING!
  316. If you use the Class(y), the each class description must be in another file.
  317.  
  318.  
  319. !seealso: "Meaning of the words" Syntax "System anomal behavior"
  320.  
  321.  
  322. '####################################################################################
  323. !short:Visibility of objects in the CLD (clipper debugger)
  324. ^BVisibility of objects in the CLD (clipper debugger):
  325. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  326.   The instances handling in form of ::Inst or ::Meth(listpar) are only the
  327.   abreviations of self:inst, self:Meth(listpar), which are preprocesored,
  328.   in the CLD use the full form.
  329.  
  330.  
  331.  
  332. '####################################################################################
  333. !short:Hardware requirements
  334. ^BHardware requirements:
  335. ~~~~~~~~~~~~~~~~~~~~~~
  336. Due to Clipper internal dyamic overlay system you have not to check the
  337. exe file size. You can run a 5MB exe file in 450Kb RAM, but internal VMM
  338. (Virtual Memory Manager) often accesses the HDD. For your programs the
  339. minimal configuration is AT286, 12MHz, 1MB RAM. The XT computers are too
  340. slowly for database aplications. I recomend to use maximal amount of memory
  341. as disk cache, with 1MB RAM it can be 640kB for DOS and 384kB for cache
  342. (it is better to use some WRITE-THROUGH cache with deferred write).
  343.  
  344. Your config.sys should contain the lines:
  345.                   FILES=79
  346.                   COUNTRY=41,,COUNTRY.SYS
  347. The amount of FILES is high because the Object.lib maintains the database
  348. files opened till finishing the program. The Country is used for Central
  349. European date format: DD.MM.YY (default clipper format is american MM.DD.YY)
  350.  
  351. Autoexec.bat should contain :
  352.                   SET CLIPPER=E0;F:69;
  353. The line (SET...) supresses the use of EMS memory
  354. (if you have memory enough can be changed) and it is enabled to open 69 files.
  355.  
  356. !seealso: "System anomal behavior"
  357.  
  358.  
  359. '####################################################################################
  360. !short:System anomal behavior or what to expect and what no
  361. ^BSystem anomal behavior or what to expect and what no:
  362. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  363.  
  364.  1. SetKey(...)    --> doesn't work for ALT-D
  365.  
  366.  2. ALT-C          --> immediate abort of program and return to DOS
  367.  
  368.  3. StuffKey(nKey) --> the queue is not erased and can be modified wrong
  369.                        when containing InKey codes out of (0..255)
  370.  
  371.  4. CLASS... and  METHOD...  definitions of the same class should be in one
  372.     separate file.
  373.     The reason: identifier names colision (only for Class(y), o:Clip has'nt
  374.     this problem but it is recomended to follow this rule.
  375.  
  376.  5. Error with text (DOS Error 4) is caused by low number of FILES in 
  377.     config.sys or low number opened files in SET CLIPPER=... in 
  378.     autoexec.bat
  379.  
  380. !seealso: "Hardware requirements" "Meaning of the words" Syntax
  381.  
  382. '
  383. '####################################################################################
  384. !short:m->tColor  numeric  0=monochrom, 1=laptop, 2=VGAmono, 3=color monitor
  385. Public variable: ^Bm->tColor^N:
  386. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  387. Value type: numeric
  388.  
  389. This variable defines monitor type, with values
  390.   0=monochrom monitor with two colors; black and white (hercules)
  391.   1=monochrom with 8-gray colors; (some laptops)
  392.   2=VGAmonochrom with 16-gray colors; (EGA,VGA monochrom)
  393.   3=color monitor with 16-colors; (EGA,VGA,HGC-InColor,...)
  394.  
  395. !seealso: ob_class.ngo:Color ob_class.ngo:"Class hierarchy"
  396.  
  397.  
  398. '####################################################################################
  399. !short:m->Color   object   color values recieved by library when painting the windows
  400. Public variable: ^Bm->Color^N:
  401. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  402. Value type: object of Color
  403.  
  404. This object defines all colors used by the library, it is created when
  405. initialising the object system (ObjectInit() function in file object1.prg.
  406. The current color values are assigned according the m->tColor variable value
  407. for the respective monitor type.
  408.  
  409. The description of m->Color object is in part Classes.
  410.  
  411. !seealso: ob_class.ngo:Color m->tColor
  412.  
  413. '
  414. '˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙ eof (c)JHK ˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙
  415. '
  416.  
  417.